package com.ganbo.ms.pool.pojo;

import com.ganbo.ms.pool.pool.SnapshotExtendPool;
import lombok.Data;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.atomic.AtomicInteger;


@Data
@ToString
@Slf4j
public class SnapshotExtend extends Snapshot {

    private String name;
    private Integer id;

    //TODO redis模块，早上7-18点发送心跳，如果发送失败就抛异常，重连

    /**
     * 引用次数计数
     */
    private AtomicInteger refCount;
    /**
     * 初始化引用次数
     */
    private Integer initRefCount;


    public SnapshotExtend(String name, Integer id, Integer initRefCount) {
        this.name = name;
        this.id = id;
        this.refCount = new AtomicInteger(initRefCount);
        this.initRefCount = initRefCount;
    }

    public void destroy() {
        log.info("销毁===========SnapshotExtend: {}", this.getId());
    }

}

